// eslint-disable-next-line no-unused-vars
import React, { Fragment } from 'react';
import { connect } from 'dva';
import './css2/div_demo2.css'

const dataArray=[
  {
    "path": "./",
    "enable": true,
    "dataType": "String",
    "name": "firstName",
    "sampleValue": "Jane",
    "currentValue": "GuoRong"
  },
  {
    "path": "./",
    "enable": true,
    "dataType": "String",
    "name": "lastName",
    "sampleValue": "Citizen",
    "currentValue": "XU"
  },
  {
    "path": "./identityVariables",
    "enable": true,
    "dataType": "String",
    "name": "birthRegistrationState",
    "sampleValue": "VIC",
    "currentValue": ""
  },
  {
    "path": "./identityVariables",
    "enable": true,
    "dataType": "Date",
    "name": "birthRegistrationDate",
    "sampleValue": "08/27/1984",
    "currentValue": null
  },
  {
    "path": "./identityVariables",
    "enable": true,
    "dataType": "String",
    "name": "birthRegistrationNo",
    "sampleValue": "500156",
    "currentValue": ""
  },
  {
    "path": "./",
    "enable": true,
    "dataType": "Date",
    "name": "dateOfBirth",
    "sampleValue": "06/07/1984",
    "currentValue": null
  }
]

const currentData={
  "firstName": "GuoRong",
  "lastName": "XU",
  "gender": "Male",
  "countryCode": "AU",
  "service": [
    "Australia Birth Certificate"
  ],
  "identityVariables": {
    "birthRegistrationState": "",
    "birthRegistrationDate": null,
    "birthRegistrationNo": ""
  },
  "clientReference": "Test_0001",
  "customerId": 661,
  "dateOfBirth": null,
  "consentObtained": {
    "Australia Birth Certificate": true
  },
  "middleName": null
}

@connect(({ airportDataModel }) => ({
  airportDataModel,
}))
class Demo2 extends React.PureComponent {
  constructor(props) {
    super(props);
    this.state = {
      data:dataArray,
    }
  }

  componentDidMount() {
    const { dispatch } = this.props;
    dispatch({
      type: 'airportDataModel/fetch',
      payload: {
        pageNo: 1,
        pageSize: 10,
      },
    });
  }

  render() {
    const{data}=this.state;
    return (
      <div className="de_main">
        <div className="de_col"><span className="de_setColor">*</span>firstname：
          <input type="text" placeholder={data[0].sampleValue} className="de_input" />
        </div>
        <div className="de_col"><span className="de_setColor">*</span>lastname：
          <input type="text" placeholder={data[1].sampleValue} className="de_input" />
        </div>
        <div className="de_col"><span className="de_setColor">*</span>birthRegistrationState：
          <input type="text" placeholder={data[2].sampleValue} className="de_input" />
        </div>
        <div className="de_col"><span className="de_setColor">*</span>birthRegistrationDate：
          <input type="date" placeholder={data[3].sampleValue} className="de_input" />
        </div>
        <div className="de_col"><span className="de_setColor">*</span>birthRegistrationNo：
          <input type="text" placeholder={data[4].sampleValue} className="de_input" />
        </div>
        <div className="de_col"><span className="de_setColor">*</span>dateOfBirth：
          <input type="date" placeholder={data[5].sampleValue} className="de_input" />
        </div>
        <div className="de_col border">
          <button className="de_btn_confirm" onClick={this.handleConfirm}>提交</button>
          <button className="de_btn_cancel" onClick={this.handleCancel}>取消</button>
        </div>
        <div>
          <textarea className="de_text" value={JSON.stringify(currentData, null, 4)} />
        </div>
      </div>
    );
  }
}

export default Demo2;
